package com.itheima.tlias.config;

import com.itheima.tlias.interceptor.TokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author mr.luo
 * @Date 16 4月 2025 10:17
 */
@Configuration //把本类作为一个配置类
public class WebConfig implements WebMvcConfigurer {
    //    @Autowired
//    private Demo1Interceptor demo1Interceptor;
    @Autowired
    private TokenInterceptor tokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login") //添加拦截的路径
                .excludePathPatterns("/captcha")
                .excludePathPatterns("/emps/forgetPwd");
    }
}
